package com.tuo.controller;

import com.tuo.beans.Orders;
import com.tuo.service.OrderService;
import com.tuo.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by tuo on 2016/1/10.
 */
@Controller
public class RedirectController {
    @Autowired
    RecordService service;


    @RequestMapping("toCustomer")
    public String customer() {
        return "customer";
    }


    @RequestMapping("toStatistics")
    public String statistics() {
        return "statistics";
    }

    @RequestMapping("toViewOrder")
    public String viewOrder(long id, ModelMap map) {
        map.put("orderId", id);
        return "orderDetail";
    }

    @RequestMapping("toOrder")
    public String order() {
        return "order";
    }

    @RequestMapping("toAddOrder")
    public String addOrder() {
        return "addOrder";
    }


    @RequestMapping("calc")
    public String Calculation() {
        try {
            this.service.task();
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        return "redirect:toOrder.htm";
    }

    @RequestMapping("index")
    public String Login() {
        return "login";
    }

}
